<?php $season = Doctrine::getTable('BbSeason')->findOneBySId($seasonId)?>
<?php $league = Doctrine::getTable('BbLeague')->findOneById($season->getLId())?>
<div class="column-left" style="border: 1px solid #C0C2C5;">
 <div class="news-title"><?php echo $league." :: ".$season ?></div>
<div id="scorebox" style="padding: 10px !important;">
    <?php 
        $matchdays = Doctrine::getTable('BbMatchday')->getMatchdays($seasonId);       
    ?>
    <?php foreach ($matchdays as $matchday): ?>
    <?php  
        $matchday_id = $matchday->getId();	
      
        $matches = Doctrine::getTable('BbMatch')->getMatches(0,$matchday_id);
          
    ?>
    <br clear="all">
    <h4 style="width:660px;"><?php echo $matchday.' :: '.$matchday->getDescr(); ?></h4>
    <br clear="all">
    <ul>
    	<?php $i=1;
    	foreach($matches as $match):
    		if($i==12)
    		   echo '<br clear="all">';	
    		else
    			$i++;
    		$team1 = $match->getBbTeams();
    		$team2 = $match->getBbTeams_2();   
    		if($match->published == 1 ) { 
    		if($match->m_played == 1) { 
    	?>
          <li class="green">
            <table width="100%;">
              <tr><td colspan="2" align="center"><span class="time"><?php echo substr($match->getMDate() , 11, 5)?></span></td></tr>
              <tr>
                <td align="middle"><a href="<?php echo url_for('match/show?seasonId='.$seasonId.'&id='.$match->getId())?>"><span class="teamname"><?php echo $team1->getTAbrname()?></span></a></td>
                <td align="middle"><a href="<?php echo url_for('match/show?seasonId='.$seasonId.'&id='.$match->getId())?>"><span <?php if( $match->getScore1() > $match->getScore2()) echo "class=\"win\"" ?> ><?php echo $match->getScore1()?></span></a></td>
              </tr>
              <tr>
                <td align="middle"><a href="<?php echo url_for('match/show?seasonId='.$seasonId.'&id='.$match->getId())?>"><span class="teamname"><?php echo $team2->getTAbrname()?></span></a></td>
                <td align="middle"><a href="<?php echo url_for('match/show?seasonId='.$seasonId.'&id='.$match->getId())?>"><span <?php if( $match->getScore1() < $match->getScore2()) echo "class=\"win\"" ?> ><?php echo $match->getScore2()?></span></a></td>
              </tr>
            </table>
          </li>
    	 <?php } else{ ?>
  		    <li>
            <table width="100%;">
              <tr><td colspan="2" align="center"><span class="time"><?php echo substr($match->getMDate() , 11, 5)?></span></td></tr>
              <tr>
                <td align="middle"><a href="<?php echo url_for('team/show?seasonId='.$seasonId.'&name='.$team1)?>"><span class="teamname"><?php echo $team1->getTAbrname()?></span></a></td>
                <td align="middle">-</td>
              </tr>
              <tr>
                <td align="middle"><a href="<?php echo url_for('team/show?seasonId='.$seasonId.'&name='.$team2)?>"><span class="teamname"><?php echo $team2->getTAbrname()?></span></a></td>
                <td align="middle">-</td>
              </tr>
            </table>
         </li>
  	   <?php }} endforeach;?>
	   <br clear="all">
    </ul>
    <?php endforeach;?>
<br clear="all">
</div>
<br clear="all">
</div>
<?php include_partial('main/right', array());?>

<br clear="all">


